package com.park.config;

import com.park.filter.StaticFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.servlet.Filter;
import java.util.ArrayList;
import java.util.List;

@Configuration
public class WebConfig {
    @Bean
    public FilterRegistrationBean<Filter> staticFilter() {
        FilterRegistrationBean<Filter> registrationBean = new FilterRegistrationBean<>();
        StaticFilter staticFilter = new StaticFilter();
        registrationBean.setFilter(staticFilter);
        List<String> urls = new ArrayList<>();
        urls.add("/static/*");
        registrationBean.setUrlPatterns(urls);

        return registrationBean;
    }
}
